package hk.ust.android_competition.user;

import java.io.IOException;

import hk.ust.android_competition.pet.Pet;
import hk.ust.android_competition.store.Costume;
import hk.ust.android_competition.store.CostumeCategory;
import hk.ust.android_competition.store.PetProduct;

/**
 * Created by Silver on 3/1/15.
 */
public class UserData {
    private String name;
    private Pet pet;
    private double coins;
    private CostumeCategory costumeCategory;

    public Pet getPet() {
        return pet;
    }

    public int getCoins() {
        return (int)coins;
    }

    public void coinIncreasePerTime() {
        coins += 0.1;
    }

    public void coinIncreasePerTimePass() {
        coins += 1500.0;
    }

    public String getName() {
        return name;
    }

    public CostumeCategory getCc() {
        return costumeCategory;
    }

    public boolean buyProduct(PetProduct pd) {
        if (this.coins >= pd.getCost()) {
            this.coins -= pd.getCost();
            return true;
        } else
            return false;
    }

    public UserData(String name, Pet pet, int coins) {
        this.name = name;
        this.pet = pet;
        this.coins = coins;
        costumeCategory = new CostumeCategory();
    }

    public void makeCostumeAvailable(Costume c) {
        costumeCategory.setCostumeAvailable(c);
    }

    public CostumeCategory getCostumeCategory() {
        return costumeCategory;
    }
}
